<!--违规操作日志-->
<template>
  <div class="current-page">
    <div>
      <!-- <el-button style="margin-bottom: 10px;float:left;padding-right: 20px" type="primary">
        高级搜索
      </el-button> -->
      <div class="search-btn">
        <!-- <el-button style="margin-bottom: 10px;float:right;padding-right: 20px" type="text" @click="exprotData"
          icon="el-icon-download">导出
        </el-button> -->
          <el-button style="margin-bottom: 10px;float:right;padding-right: 20px" type="text" @click="reshua"
          icon="el-icon-refresh">刷新
        </el-button>
      </div>
    </div>
    <com-table :tableData="tableData" url="sjrz/log/viooper"  method="get" keyName="LogVioOper" :has-data="hasData"
      :table-head-list="tableHeadList" :total-count="totalCount" :page-num="pageNum" :page-size="pageSize"
      :page-sizes="pageSizes" :table-loading="loading" :table-height="tableHeight" :is-show-select="false"
      :page-show="true" :handle-show="false" :merge-flag="false"  @getTabpation="getTabpation" @setSearchHeight="setSearchHeight" ref="comTable">
    </com-table>

  </div>
</template>
<script>
import ComTable from "../../components/table/comTable";
export default {
  name: "violationLog",
  data() {
    return {
      pageSizes: [5, 10, 20, 50, 100],
      hasData: true,
      dialogControl: false,
      dialogTitle: "",
      tableHeadList: [
        { colDisabled: false, colHidden: false, colSearch: true, colSort: false, columnComment: "用户名", columnName: "LoginUser", },
        { colDisabled: false, colHidden: true, colSearch: true, colSort: false, columnComment: "责任人ID", columnName: "EmpId", },
        { colDisabled: false, colHidden: false, colSearch: true, colSort: false, columnComment: "部门", columnName: "DeptName", },
        { colDisabled: false, colHidden: false, colSearch: true, colSort: false, columnComment: "责任人", columnName: "EmpName", },
        { colDisabled: false, colHidden: false, colSearch: true, colSort: false, columnComment: "IP地址", columnName: "IP", },
        { colDisabled: false, colHidden: false, colSearch: true, colSort: false, columnComment: "MAC地址", columnName: "MAC", },
        { colDisabled: false, colHidden: true, colSearch: true, colSort: false, columnComment: "部门ID", columnName: "DeptId", },
        { colDisabled: false, colHidden: true, colSearch: true, colSort: false, columnComment: "部门全称", columnName: "FullDeptName", },
        { colDisabled: false, colHidden: false, colSearch: true, colSort: false, columnComment: "操作时间", columnName: "OpTime", showtooltip: "true" },
        { colDisabled: false, colHidden: false, colSearch: true, colSort: false, columnComment: "描述", columnName: "Content" },
      ],
      pageNum: 1,
      pageSize: 10,
      totalCount: 0,
      boolean: [],
      tableData: [], // 表格数据
      tableHeight: 300, // 表格高度
      loading: false, // 数据加载状态遮罩
      tableDataSelected: [],
      operateTime: [],
      xproPath: '',
      searchForm: {
        warnState: "",
        warnRank: "",
        warnContent: "",
        objType: "",
      },
      infoForm: {
        from: '本地'
      },
      attrData: [],
      rules: {
        // 表单验证规则
        name: [{ required: true, trigger: "blur", message: "请输入名称" }],
      },
      emwCheckList: [],
    };
  },
  components: {
    ComTable,
  },
  created() {
    this.setTableHeight();
    //this.getattrDataList(this.pageNum, this.pageSize)
    this.refreshTable()
  },
  methods: {
    refreshTable() {
      if (this.hasData) {
        this.getTableData(this.pageNum, this.pageSize);
      } else {
        // 调用子组件中的getTableData
        this.$refs.comTable.getTableData();
      }
    },
    //重新加载表格
    setSearchHeight() {
      //搜索区域高度
      if (this.$refs.search !== undefined) {
        this.$nextTick(() => {
          let searchHeight = this.$refs.search.offsetHeight;
          this.setTableHeight(searchHeight);
        });
      }
    },
    //关闭表单
    dialogClosed() {
      this.infoForm = {
        name: "",
        ip: '',
        port: '',
        type: [],
        from: '本地'
      };
    },
    headerCellStyle({ row, column, rowIndex, columnIndex }) {
      return {
        "font-size": "14px",
        "font-weight": 600,
        color: "#606266",
      };
    },
    //查询
    //todo 待后台接口
    reshua() {
      this.pageNum = 1
      this.pageSize = 10
      this.refreshTable()
     },
     getTableData(pageNum, pageSize){
      this.$get(`sjrz/log/viooper?page=${pageNum}&count=${pageSize}`).then((res) => {
        console.log(res);
        this.tableData = res.data.data.Root.LogVioOper
        this.totalCount = this.tableData.length
      });
     },
     getTabpation(pageNum, pageSize) {
      this.getTableData(pageNum, pageSize)
    },
    //导出
    exprotData() {

    },
    setTableHeight() {
      let clientHeiht =
        window.innerHeight || document.documentElement.clientHeight;
      this.tableHeight = clientHeiht - 160;
    },
  },
};
</script>
<style scoped>
@import "../../assets/css/commonTable.css";

.view {
  position: relative;
  left: 190px;
}

.title-left {
  display: inline-block;
  font-weight: 600;
  margin-left: 20px;
  margin-top: 7px;
}

.right {
  float: right;
  margin-right: 20px;
}

.block {
  text-align: center;
  margin-right: 20px;
  margin-top: 10px;
}

.checkTitle {
  width: 164px;
  height: 16px;
}

.importOrgInfo {
  cursor: pointer;
  color: #101fec;
  text-decoration: underline;
}

.importBody {
  display: flex;
  align-items: center;
  flex-grow: 1;
}

.seamless-warp {
  height: 250px;
  overflow: hidden;
}

.importIcon {
  font-size: 52px;
  width: 90px;
  text-align: center;
}

.new-search-area .btn-area .el-button {
  margin-bottom: 10px;
}

.hstyle {
  color: lightskyblue;
  margin: 10px;
  border-bottom: 1px solid #999;
}

.pstyle {
  margin-left: 25px;
  cursor: pointer;
}

.rightStyle {
  /* padding-left: 5px; */
  border: 1px solid rgb(235, 238, 245);
  border-radius: 5px;
}

ul {
  padding-inline-start: 25px;
}

ul li {
  list-style-type: none;
  line-height: 25px;
  font-size: 15px;
}

ul li:hover {
  color: lightskyblue;
  cursor: pointer;
}

.active {
  color: lightskyblue;
}

.butt {
  margin-left: 116px !important;
  margin-top: 22px;
  margin-bottom: 20px;
}

.page {
  position: absolute;
  bottom: 63px;
  left: 900px;
}
</style>
